from PyInstaller.utils.hooks import collect_data_files, collect_submodules

datas = [
    ('ui/dist/index.html', 'ui/dist'),
    ('ui/dist/vite.svg', 'ui/dist'),
    ('ui/dist/assets/*', 'ui/dist/assets')
    # 按照实际情况添加其他子目录或文件
]

hiddenimports = []

excludes = [
    'tkinter',  # 排除 GUI 模块
    'matplotlib',  # 排除科学计算模块
]

a = Analysis(
    ['app.py'],
    pathex=['.'],  # 当前目录
    binaries=[],
    datas=datas,
    hiddenimports=hiddenimports,
    hookspath=[],
    runtime_hooks=[],
    excludes=excludes,
    win_no_prefer_redirects=False,
    win_private_assemblies=False,
    cipher=None,
)

pyz = PYZ(a.pure, a.zipped_data, cipher=None)

exe = EXE(
    pyz,
    a.scripts,
    a.binaries,
    a.zipfiles,
    a.datas,
    [],
    name='app',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=False,  # 根据实际情况调整
    onefile=True,
    console=False  # 若不需要命令行窗口
)